package com.app.ctzoverseas.network.http

import com.android.base_network.RetrofitClient
import com.cardetective.shopcar.network.api.AddressApi
import com.cardetective.shopcar.network.api.GoodsApi
import com.cardetective.shopcar.network.api.LoginApi
import com.cardetective.shopcar.network.model.AddCarPost
import com.cardetective.shopcar.network.model.BindMobilePost
import com.cardetective.shopcar.network.model.LoginPost

class AddressNetwork {

    private val mAddressApi by lazy { RetrofitClient.getInstance().createApi(AddressApi::class.java) }

    fun getDefaultAddress() = mAddressApi.getDefaultAddress()
    fun addAddress(firstName: String,surName: String,userMobile: String,etHouse: String,isDefault: Boolean) = mAddressApi.addAddress(firstName,surName,userMobile,etHouse,isDefault)
    fun getAddressList(pageNumber: Int,pageSize: Int) = mAddressApi.getAddressList(pageNumber, pageSize)
    fun deleteAddress(addressId: String) = mAddressApi.deleteAddress(addressId)
    fun updateAddress(addressId: String,isDefault:Boolean) = mAddressApi.updateAddress(addressId,isDefault)

    companion object {
        @Volatile
        private var netWork: AddressNetwork? = null

        fun getInstance() = netWork ?: synchronized(this) {
            netWork ?: AddressNetwork().also { netWork = it }
        }
    }
}